package com.sacfa.commons.sql;

public class EmailSQL {
	public static final String SELECT_ONE;
    public static final String SELECT_ALL_CLIENTE;
    public static final String SELECT_ALL_PROVEEDOR;
    public static final String SELECT_ALL_EMPLEADO;
    public static final String INSERT;
    public static final String INSERT_CLIENTE;
    public static final String INSERT_PROVEEDOR;
    public static final String INSERT_EMPLEADO;
    public static final String UPDATE;
    public static final String DELETE;
    public static final String DELETE_CLIENTE;
    public static final String DELETE_PROVEEDOR;
    public static final String DELETE_EMPLEADO;
    
    static {
        StringBuilder qryBuilder = new StringBuilder();

        qryBuilder.append("SELECT * FROM Email WHERE idEmail = ?");
        SELECT_ONE = qryBuilder.toString();

        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM EmailCliente WHERE idCliente = ?");
        SELECT_ALL_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM EmailProveedor WHERE idProveedor = ?");
        SELECT_ALL_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM EmailEmpleado WHERE idEmpleado = ?");
        SELECT_ALL_EMPLEADO = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO Email VALUES(null, ?, ?)");
        INSERT = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO EmailCliente VALUES(?, ?)");
        INSERT_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO EmailProveedor VALUES(?, ?)");
        INSERT_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO EmailEmpleado VALUES(?, ?)");
        INSERT_EMPLEADO = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("UPDATE Email set Email = ?, TipoEmail = ? WHERE idEmail = ?");
        UPDATE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM Email WHERE idEmail = ?");
        DELETE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM EmailCliente WHERE Cliente = ? AND Email = ?");
        DELETE_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM EmailProveedor WHERE Proveedor = ? AND Email = ?");
        DELETE_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM EmailEmpleado WHERE Proveedor = ? AND Email = ?");
        DELETE_EMPLEADO = qryBuilder.toString();
    }
}
